﻿using System;
using System.Collections.Generic;

namespace HK.Core.Common.Protocol.Data
{
    /// <summary>
    /// 比较选项
    /// </summary>
    [Flags]
    public enum CompareOptions
    {
        /// <summary>
        /// 无
        /// </summary>
        None = 0x00000000,
        /// <summary>
        /// 小于
        /// </summary>
        Less = 0x00000001,
        /// <summary>
        /// 不小于
        /// </summary>
        NotLessThan = 0x00000002,
        /// <summary>
        /// 小于等于
        /// </summary>
        LessThanOrEqual = 0x00000004,
        /// <summary>
        /// 大于
        /// </summary>
        Greater = 0x00000008,
        /// <summary>
        /// 不大于
        /// </summary>
        NotGreaterThan = 0x00000010,
        /// <summary>
        /// 小于等于
        /// </summary>
        GreaterThanOrEqual = 0x00000020,
        /// <summary>
        /// 等于
        /// </summary>
        Equals = 0x00000040,
        /// <summary>
        /// 不等于
        /// </summary>
        NotEquals = 0x00000080,
        /// <summary>
        /// 介于A与B之间
        /// </summary>
        Between = 0x00000100,
        /// <summary>
        /// 以XXX开头
        /// </summary>
        StartWith = 0x00000200,
        /// <summary>
        /// 包含
        /// </summary>
        Contains = 0x00000400,
        /// <summary>
        /// 以XXX结尾
        /// </summary>
        EndsWith = 0x00000800,
        /// <summary>
        /// 忽略大小写
        /// </summary>
        IgnoreCase = 0x00001000,
        
        /// <summary>
        /// 全部
        /// </summary>
        All = Less | NotLessThan | LessThanOrEqual | Greater | NotGreaterThan | GreaterThanOrEqual | Equals | NotEquals | Between | StartWith | Contains | EndsWith | IgnoreCase,
        
        /// <summary>
        /// 数字比较
        /// </summary>
        NumberCompare = Less | NotLessThan | LessThanOrEqual | Greater | NotGreaterThan | GreaterThanOrEqual | Equals | NotEquals | Between,
        
        /// <summary>
        /// 布尔值比较
        /// </summary>
        BoolCompare = Equals | NotEquals,
        
        /// <summary>
        /// 枚举体比较
        /// </summary>
        EnumCompare = Equals | NotEquals,
        
        /// <summary>
        /// 字符串比较
        /// </summary>
        StrCompare = Equals | NotEquals | StartWith | Contains | EndsWith | IgnoreCase,
        
        /// <summary>
        /// 大小比较
        /// </summary>
        ResolutionCompare = Less | NotLessThan | LessThanOrEqual | Greater | NotGreaterThan | GreaterThanOrEqual | Equals | NotEquals | Between,
        
        /// <summary>
        /// 文件大小比较
        /// </summary>
        FileSizeCompare = Less | NotLessThan | LessThanOrEqual | Greater | NotGreaterThan | GreaterThanOrEqual,
        
        /// <summary>
        /// 颜色比较
        /// </summary>
        ColorCompare = Equals | NotEquals,
        
        /// <summary>
        /// 场景文件
        /// </summary>
        SceneFileOnly = IgnoreCase | EndsWith,
        
        /// <summary>
        /// 纹理格式
        /// </summary>
        TextureFormatCompare = Equals | NotEquals,
        
        /// <summary>
        /// 纹理Quality
        /// </summary>
        TextureQuality = Equals | NotEquals,
        
        /// <summary>
        /// 纹理 - Android Ect2 Fallback Override
        /// </summary>
        TextureEtc2Override = Equals | NotEquals
    }

    /// <summary>
    /// 接口 : 文件后缀
    /// </summary>
    public interface IFileExtension : IListElement
    {
        /// <summary>
        /// 标题描述
        /// </summary>
        string TitleDesc { get; }
        
        /// <summary>
        /// 后缀
        /// </summary>
        string Extension { get; }
    }

    /// <summary>
    /// 接口 : 文件后缀列表
    /// </summary>
    public interface IFileExtensions : IJsonData
    {
        /// <summary>
        /// 后缀列表
        /// </summary>
        List<string> Extensions { get; }
        
        /// <summary>
        /// 浏览选项列表
        /// <para>* 文件后缀列表格式:{ "FileType", "FileExtensions" }</para>
        /// <para>* 如：{ "Image files", "png,jpg,jpeg" }</para>
        /// </summary>
        string[] BrowseExtensions { get; }
    }
    
    /// <summary>
    /// 接口 : 过滤数据
    /// </summary>
    public interface IFilterData
    {
        /// <summary>
        /// 比较选项
        /// </summary>
        int CompareOptions { get; }
        
        /// <summary>
        /// 过滤扩展选项
        /// <para>* 可以追加列入后缀名等信息</para>
        /// </summary>
        IFileExtensions Extensions { get; }

        /// <summary>
        /// 过滤
        /// </summary>
        /// <param name="iTarget">目标对象</param>
        /// <returns>true:通过过滤; false:未通过过滤;</returns>
        bool Filter(string iTarget);
    }
}
